<{include file="element/inc_header.html"}>

    
    <div id="box">
		<div id="bg_light" class="bg_light mv_rt"></div>
<!--        <img src="index/www/img/bg_right.gif" class="bg_light"/> -->
		<div id="bg_cloud"></div>
		<div id="page1" class="page" style="display: block">
			<div id="bg_logo"></div>
			<div id="index_mid"></div>
			<div id="index_txt"></div>
			<div id="start_btn" class="mv_big"></div>
			<div id="pop_mark"></div>
			<div id="pop_box">
				<img src="index/www/img/pop_txt.png" />
				<div id="close_pop_btn"></div>
			</div>
		</div> 
		<div id="page2" class="page">
			<div id="sceen_top"></div>
			<div id="swp_box">
				 <div class="banner_box" id="banner_box">
				 	<div class="sc1"></div>
				 	<div class="sc2"></div>
				 	<div class="sc3"></div>
				 	<div class="sc4"></div>
				 	<div class="sc5"><input type="text" maxlength="10" id="your_resion" /></div>
				 </div>
				 <div class="banner_btn b_pre_btn disable"></div>
				 <div class="banner_btn b_next_btn"></div>
			</div>
			<div class="cc"></div>
			<div class="pagebar">
				<u></u><u></u><u class="cur"></u><u></u><u></u>
			</div>
			<div id="show_share_btn"></div>
			<div id="share_box">
				<img src="index/www/img/share_img1.png" />
			</div>
		</div> 
	</div>
<script language="javascript">
//默认的分享方案
var sTitle = '你造吗？借钱也是看人品哦！赶来测测么？';
var sDesc = '';
var sImg = 'http://pingan.weixinzjit.com/index/www/img/share.jpg';
var sLink = location.href;
</script> 
<{include file="element/inc_loading.html"}>
<script language="javascript">
/**
 * Created by Nicky on 15-11-12.
 */
var curPage = 0;
var word = '';
var rando = parseInt(Math.random()*100000000);

function start(){

	document.body.addEventListener('touchmove', function(event) { event.preventDefault(); }, false); 
	
	$('#close_pop_btn').click(function(){ 
		$('#pop_mark , #pop_box').fadeOut();
		$('#page1').fadeOut();
		$('#page2').fadeIn();
	});
	$('#btn_gonglue').click(function(){
		$('#pop_box').css('top',($(window).height()-903)/2);
		$('#pop_mark , #pop_box').fadeIn();
	});
	$('#start_btn').click(function(){
		$('#pop_box').css('top',($(window).height()-903)/2);
		$('#pop_mark , #pop_box').fadeIn();
		
	});
 
	touch.on('#swp_box', 'swipeleft swiperight', function(ev){
	    if(ev.type=='swiperight'){
			curPage--;
			if(curPage<0){ curPage = 0; }
		}else{
			curPage++;
			if(curPage>4){ curPage = 4; }
		}
		showPage(curPage); 
	});

	$('#show_share_btn').click(function(){
		$('#share_box').fadeIn();
	});
	
	$('#share_box').click(function(){
		$(this).fadeOut();
	});
	
	showPage(0);
};

function getShareText(tindex){
	var TXTARR = [
		'准备换套房子押一付三还缺钱！',
		'买买买！信用卡已爆……卡账还不出，先借我点！',
		'带女票去做小手术，借点钱，你懂的…',
		'没想到被碰瓷儿了！借我点钱脱身！'
	];
	if(tindex<4){
		return TXTARR[tindex];
	}else{
		var ret = $('#your_resion').val();
		if(ret.length<1){
			ret = "你造吗?借钱也是看人品哦!敢来测测么?";
		}
		return ret;
	}
}

function showPage(index){ 
	var scw = $(window).width();  
	$('#banner_box').animate({left:(0-(index)*scw)+'px'},300); 
	if(index>0){
		$('.b_pre_btn').removeClass('disable');
	}else{
		$('.b_pre_btn').addClass('disable');
	}
	if(index<4){
		$('.b_next_btn').removeClass('disable');
	}else{
		$('.b_next_btn').addClass('disable');
	}
	$('.pagebar .cur').removeClass('cur');
	$($('.pagebar u')[index]).addClass('cur');	
}

</script>
<!-- 微信分享 Start -->

<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

<script language="javascript">
wx.config({
    //debug: true,
    appId: '<{$JK.appid}>', // 必填，公众号的唯一标识
    timestamp: <{$JK.timestamp}>, // 必填，生成签名的时间戳
    nonceStr: '<{$JK.noncestr}>', // 必填，生成签名的随机串
    signature: '<{$JK.signature}>',// 必填，签名，见附录1
    jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone']
});
wx.ready(function(){  
	InitSetting(); 
});
wx.error(function(res){ });
//设置分享信息
function InitSetting(){
	wx.onMenuShareTimeline({ title: sTitle,  link: sLink, imgUrl: sImg, trigger:function(){ 
        _this = this;
        var word = getShareText(curPage);
		_this.title = word;
		_this.imgUrl = '<{$my.headimgurl}>';
		_this.link = 'http://pingan.weixinzjit.com/index.php?c=main&a=talk&random='+rando;
		$.post('/index.php?c=main&a=saveGame',{'openid':'<{$openid}>','xielie':curPage,'word':word,'random':rando },function(rs){});
	}, success: function () {}, cancel: function () {} });
	wx.onMenuShareAppMessage({ title: '', desc: sTitle, link: sLink, imgUrl: sImg, trigger:function(){ 
        _this = this;
        var word = getShareText(curPage);
		_this.desc = word;
		_this.imgUrl = '<{$my.headimgurl}>'; 
		_this.link = 'http://pingan.weixinzjit.com/index.php?c=main&a=talk&random='+rando;
		$.post('/index.php?c=main&a=saveGame',{'openid':'<{$openid}>','xielie':curPage,'word':word,'random':rando },function(rs){});
	}, success: function () {}, cancel: function () {} }); 
	wx.onMenuShareQQ({ title: sTitle, desc: sDesc, link: sLink, imgUrl: sImg, success: function () {}, cancel: function () {} });  
}
 
</script>

<!-- 微信分享 End -->
<{include file="element/inc_footer.html"}>